package cn.anecansaitin.firecrafting;

import cn.anecansaitin.firecrafting.common.menu.ModMenuTypes;
import cn.anecansaitin.firecrafting.client.screen.ModScreens;
import cn.anecansaitin.firecrafting.common.Config;
import cn.anecansaitin.firecrafting.common.block.ModBlocks;
import cn.anecansaitin.firecrafting.common.block.entity.ModBlockEntityTypes;
import cn.anecansaitin.firecrafting.common.crafting.ModRecipeTypes;
import cn.anecansaitin.firecrafting.common.item.ModItems;
import cn.anecansaitin.firecrafting.common.net.ModNetwork;
import net.minecraft.client.KeyboardHandler;
import net.minecraft.client.Minecraft;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.lwjgl.glfw.GLFW;

//Mod主类
@Mod(ModConstant.MOD_ID)
public class FireCrafting {
    public FireCrafting() {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::clientSetup);
        bus.addListener(this::setup);
        //配置文件注册
        ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.CONFIG);
        //配方注册
        ModRecipeTypes.registry(bus);
        //方块注册
        ModBlocks.registry(bus);
        //方块实体注册
        ModBlockEntityTypes.registry(bus);
        //物品注册
        ModItems.registry(bus);
        //GUI注册
        ModMenuTypes.MENU.register(bus);
    }

    public void clientSetup(FMLClientSetupEvent event) {
        ModScreens.register();
    }

    public void setup(FMLCommonSetupEvent event) {
        ModNetwork.registry();
    }
}
